package com.imooc.controller;

import com.a3test.component.idworker.Snowflake;
import com.imooc.feign.TeacherFeignService;
import com.imooc.grace.result.GraceJSONResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
@RequestMapping("stu")
public class HelloController {

    @Autowired
    private Snowflake snowflake;

    @GetMapping("hello")
    public Object hello() {
        String id = snowflake.nextId();
        System.out.println(id);

        return "Hello Student~";
    }

    @Autowired
    private TeacherFeignService teacherFeignService;

    @GetMapping("getTeacherFeign")
    public Object getTeacherFeign() {
        GraceJSONResult result = teacherFeignService.queryTeacher();
        return result;
    }


}
